/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bullionxpress.client.view;
// Private classes.

import com.bullionxpress.client.controller.CommandController;
import com.bullionxpress.shared.model.Command;
import java.awt.Component;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Icon;

/**
 * An action that shows a message in a dialog.
 */
public class MessageAction extends AbstractAction {

    private Component parentComponent;
    private String message;
    private String name;
    private Command command = null;
    private CommandController controller = null;

    public MessageAction(Component parentComponent, String name, Icon icon, String message, Command command) {
        super(null, icon);

        this.command = command;
        this.message = message;
        this.name = name;
        this.parentComponent = parentComponent;
    }

    public void actionPerformed(ActionEvent e) {
        //throw new UnsupportedOperationException("Not supported yet.");
        CommandController c = new CommandController();
        ActionEvent ae = new ActionEvent(c, 0, command.toString());
        c.actionPerformed(ae);
    }
}
